//
//  ZCXPetPictureView.m
//  LoveOfPet
//
//  Created by dllo on 15/11/19.
//  Copyright © 2015年 孔维. All rights reserved.
//

#import "ZCXPetPictureView.h"
#import <SDWebImageManager.h>
#import <UIImageView+WebCache.h>
#define HEIGHT  [[UIScreen mainScreen]bounds].size.height / 667
#define WIDTH   [[UIScreen mainScreen]bounds].size.width / 375
@interface ZCXPetPictureView ()
@property (nonatomic, retain) UIImageView *imageV;
@property (nonatomic, retain) UILabel *feelLabel;
@end

@implementation ZCXPetPictureView
- (void)dealloc{
    [_pic release];
    [_titlen release];
    [_imageV release];
    [_feelLabel release];
    [super dealloc];
}
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageV = [[UIImageView alloc]initWithFrame:CGRectMake(5 * WIDTH, 5 * HEIGHT, frame.size.width - 10 * WIDTH, frame.size.height - 65 * HEIGHT)];
        [self addSubview:_imageV];
        [_imageV release];
        
        self.feelLabel = [[UILabel alloc]initWithFrame:CGRectMake(5 * WIDTH, frame.size.height - 55 * HEIGHT, frame.size.width - 10 * WIDTH, 45 * HEIGHT)];
        [self addSubview:_feelLabel];
        _feelLabel.backgroundColor = [UIColor whiteColor];
        _feelLabel.layer.masksToBounds = YES;
        _feelLabel.layer.cornerRadius = 2 * WIDTH;
        _feelLabel.textAlignment = NSTextAlignmentCenter;
        [_feelLabel release];
        
    }
    return self;
}
- (void)setPic:(NSString *)pic{
    if (_pic != pic) {
        [_pic release];
        _pic = [pic retain];
    }
    [_imageV sd_setImageWithURL:[NSURL URLWithString:pic]];
}
- (void)setTitlen:(NSString *)titlen{
    if (_titlen != titlen) {
        [_titlen release];
        _titlen = [titlen retain];
    }
    _feelLabel.textColor = [UIColor grayColor];
    _feelLabel.numberOfLines = 0;
    _feelLabel.font = [UIFont systemFontOfSize:13 * WIDTH];
    _feelLabel.text = titlen;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
